package com.xxx.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.xxx.domain.CourseUserLearn;
import com.xxx.mapper.CourseUserLearnMapper;
import com.xxx.service.ICourseUserLearnService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author jh
 * @since 2025-09-03
 */
@Service
public class CourseUserLearnServiceImpl extends ServiceImpl<CourseUserLearnMapper, CourseUserLearn> implements ICourseUserLearnService {

    @Override
    public CourseUserLearn checkIsBuy(Long loginId, Long courseId) {
        EntityWrapper<CourseUserLearn> wrapper = new EntityWrapper<CourseUserLearn>();
        wrapper.eq("login_id", loginId);
        wrapper.eq("course_id", courseId);
        wrapper.eq("state", 0);
        CourseUserLearn courseUserLearn = selectOne(wrapper);
        return courseUserLearn;
    }
}
